package com.matrix.java.chap_06;

import java.util.Scanner;


/*
    回文整数
 */
public class Ex6_03 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("整数: ");
        long num = input.nextLong();
        input.close();
        System.out.println(isPalindrome(num) ? "Yes" : "No");
    }

    private static boolean isPalindrome(long num) {
        boolean isPalindrome = false;
        if (num == reverse(num)) {
            isPalindrome = true;
        }
        return isPalindrome;
    }

    private static long reverse(long num) {
        long reverse = 0;
        do {
            reverse = reverse * 10 + num % 10;
            num /= 10;
        } while (num != 0);
        return reverse;
    }
}
